# -*- coding: utf-8 -*-
import scrapy
from scrapy import Request
from scrapy import FormRequest

class TbkSpider(scrapy.Spider):
    name = "tbk"
    allowed_domains = ["ikeepfit.cn"]
    start_urls = ["https://api1.coacht.ikeepfit.cn/workout/plan/indexv1"]

    def after_login(self,res):
        print "@@@@@@@@@@@@"
        print res.body
        print "@@@@@@@@@@@@"
        for url in self.start_urls:
            yield
            Request(url)

    def start_requests(self):
        login_url = "https://uc.coacht.ikeepfit.cn/UC/users"
        # tel = raw_input("请输入电话号码：")
        data = {"type":"4","tel":"15275538980","password":"7c4a8d09ca3762af61e59520943dc26494f8941b"}
        yield FormRequest(url=login_url,formdata=data,callback=self.after_login)
    def parse(self,res):
        print "########"
        print res.body
        print "########"

